C Programming
Q51.
Consider the following C program: main() { float sum= 0.0, j=1.0,i=2.0; while(i/j>0.001){ j=j+1; sum=sum+i/j; printf("%f/n", sum); } }Q52.
Consider the following C code segment: #include < stdio.h > main() { int i, j, x; scanf("%d", &x); i=1; j=1; while (i<10) { j =j*i; i= i+1; if(i==x) break; } }For the program fragment above, which of the following statements about the variables i and j must be true after execution of this program? [ !(exclamation) sign denotes factorial in the answer]Q53.
What is printed by the following ANSI C program?#include < stdio.h > int main(int argc, char *argv[]){ char a = 'P'; char b = 'x'; char c = (a & b) + '*'; char d = (a | b) - '-'; char e = (a ^ b) + '+'; printf("%c %c %c \n", c, d, e); return 0; } ASCII encoding for relevant characters is given belowQ54.
What does the following program do when the input is unsigned 16 bit integer? #include < stdio.h > main(){ unsigned int num; int i; scanf("%u", #); for(i=0;i<16;i++){ printf("%d", (num < < i&1 < < 15)?1:0); } }Q55.
The attributes of three arithmetic operators in some programming language are given below. The value of the expression 2-5+1-7*3 in this language is_______ .Q56.
Consider the following C program. #include < stdio.h > int main ( ) { int m = 10; int n, n1; n = ++m; n1 = m++; n--; --n1; n-=n1; printf ("%d", n) ; return 0; } The output of the program is ______________.Q57.
Consider the following statements #define hypotenuse (a, b) sqrt (a*a+b*b);The macro call hypotenuse(a+2,b+3);Q59.
Consider the following program fragment i=6720; j=4; while (i%j)==0 { i=i/j; j=j+1; }On termination j will have the valueQ60.
The following three 'C' language statements is equivalent to which single statement?y=y+1; z=x+y; x=x+1